using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace MyCleverWizard
{
    public partial class ProgressSheet : UserControl
    {
        public ProgressSheet()
        {
            InitializeComponent();
        }

        public void StartMission()
        {
            this.backgroundWorker1.RunWorkerAsync();
        }

        private void MissionProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            this.backgroundWorker1.ReportProgress(e.ProgressPercentage);            
        }

        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            Form1 wizardForm = (Form1)this.ParentForm;
            wizardForm.MissionReference.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(MissionProgressChanged);
            wizardForm.MissionReference.Start();
        }

        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            this.progressBar1.Value = e.ProgressPercentage;
        }
    }
}
